<?php
	//引入数据库
	require './init.php';
	$id = $_GET['id'];
	//sql语句
	$sql = "select a.*,b.class_name,c.picName from 
	stu a left join class b on a.cid = b.id
	left join photo c on a.pid = c.id
	where a.id=$id";
	//发送sql语句,并返回查询结果
	$result = mysql_query($sql);
	$row = mysql_fetch_assoc($result);
			var_dump($row);
	
	$arrHobby = explode(",",$row['hobby']);
?>

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>xxx的个人主页--《学生信息管理系统》</title>

    <!-- Bootstrap -->
    <link href="./static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="./static/css/style.css"/>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
  	<!--头部-->
  	<div class="header">
	    <div class="jumbotron">
			  <h1>学生信息管理系统</h1>
			</div>
  	</div>
  	
  	<!--详情页-->
  	<div class="container">
  		<ol class="breadcrumb">
			  <li><a href="index.html">主页</a></li>
			  <li class="active">xxx的个人主页</li>
			  <a href="./admin/edit.php?id=<?php echo $row['id'];?>" class="btn btn-xs btn-success pull-right" >编辑资料</a>
			</ol>
			<div class="row">
				<div class="col-md-6">
					<ul class="list-group">
						<li class="list-group-item">ID：<?php echo $row['id']?></li>
					  <li class="list-group-item">学号：<?php echo $row['stu_num'];?></li>
					  <li class="list-group-item">姓名：<?php echo $row['name']?></li>
					  <li class="list-group-item">性别：<?php echo $row['sex']?></li>
					  <li class="list-group-item">班级：<?php echo $row['class_name']?></li>
					  <li class="list-group-item">Q  Q：<?php echo $row['qq']?></li>
					  <li class="list-group-item">手机：<?php echo $row['phone']?></li>
					  <li class="list-group-item">生日：<?php echo $row['birthday']?></li>
					  <li class="list-group-item">个人主页：<?php echo $row['homepage']?></li>
					  <li class="list-group-item">个人爱好：
					  	<?php for($i=0;$i<count($arrHobby);$i++){ ?>
					  	<span class="label label-default"><?php echo $arrHobby[$i];?></span>
					  	<?php } ?>
					  </li>
					  <li class="list-group-item">个人简介：
					  	<p><?php echo $row['info'];?></p>
					  </li>
					</ul>
				</div>
				<div class="col-md-6">
					<img src="<?php echo './static/img/'.$row['picName']?>" class="pull-right img-circle" alt="" style="width:200px;height:200px;"/>
				</div>
			</div>
  	</div>
  	
		<!--底部-->
		<footer>
			<p>
				<a href="./index.html">首页</a>
				<a href="./photowall.html">照片墙</a>
				<a href="./add.html">添加学生</a>
			</p>
			<p>大涛课堂——《学生信息管理系统》</p>
		</footer>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="./static/lib/bootstrap/js/bootstrap.js"></script>
  </body>
</html>